#ifndef _DBITARITHMETIC_H
#define _DBITARITHMETIC_H

//==============================================================================
//
//    DBitArithmetic - the protocol for classes that implement bit arithmetic
//
//               Copyright (C) 2006  Dick van Oudheusden
//  
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free
// Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
//==============================================================================
// 
//  $Date: 2006-01-23 19:04:16 $ $Revision: 1.1 $
//
//==============================================================================


//
// The DBitArithmetic protocol specifies methods for classes that can perform 
// bit arithmetic: and, or, xor, lshift, rshift and complement.
// 


@protocol DBitArithmetic

//
// And with another object
//
// @param other    the other object
//
// @return the object
//
- (id <DBitArithmetic>) and :(id <DBitArithmetic>) other;

//
// And two objects and store the result in this object
//
// @param src1     the first object
// @param src2     the second object
//
// @return the object
//
- (id <DBitArithmetic>) and :(id <DBitArithmetic>) src1 :(id <DBitArithmetic>) src2;

//
// Or with another object
//
// @param other     the other object
//
// @return the object
//
- (id <DBitArithmetic>) or :(id <DBitArithmetic>) other;

//
// Or two objects and store the result in this object
//
// @param src1      the first object
// @param src2      the second object
//
// @return the object
//
- (id <DBitArithmetic>) or :(id <DBitArithmetic>) src1 :(id <DBitArithmetic>) src2;

//
// Xor with another object
//
// @param other     the other object
//
// @return the object
//
- (id <DBitArithmetic>) xor :(id <DBitArithmetic>) other;

//
// Xor two objects and store the result in this object
//
// @param src1      the first object
// @param src2      the second object
//
// @return the object
//
- (id <DBitArithmetic>) xor :(id <DBitArithmetic>) src1 :(id <DBitArithmetic>) src2;

//
// Left shift the object
// 
// @param shifts   the number of shifts
// 
// @return the object
// 
- (id <DBitArithmetic>) lshift :(unsigned long) shifts;

//
// Left shift an object and store the result in this object
//
// @param src      the object to be shifted
// @param shifts   the number of shifts
// 
// @return the object
// 
- (id <DBitArithmetic>) lshift :(id <DBitArithmetic>) src :(unsigned long) shifts;

//
// Right shift the object
// 
// @param shifts   the number of shifts
// 
// @return the object
// 
- (id <DBitArithmetic>) rshift :(unsigned long) shifts;

//
// Right shift an object and store the result in this object
// 
// @param src      the number to be shifted
// @param shifts   the number of shifts
// 
// @return the object
// 
- (id <DBitArithmetic>) rshift :(id <DBitArithmetic>) src :(unsigned long) shifts;

//
// One's complement the object
// 
// @return the object
// 
- (id <DBitArithmetic>) com;
 
@end

#endif

